package com.bookstore.service.impl;

import com.bookstore.entity.Review;
import com.bookstore.mapper.ReviewMapper;
import com.bookstore.service.ReviewService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author Cofe
 * @Date 2022/5/19 12:45
 */
@Service
public class ReviewServiceImpl implements ReviewService {
    @Resource
    private ReviewMapper rm;

    @Override
    public String addReview(int book_bid, String user_name, String book_review) {
        Integer integer = rm.insertReview(book_bid, user_name, book_review);
        if(integer>0){
            return "发布成功!";
        }else{
            return "系统繁忙,请稍后重试...";
        }
    }

    @Override
    public List<Review> getReviewByid(int book_bid) {
        List<Review> reviews = rm.selectReviewByid(book_bid);
        return reviews;
    }
}
